import { useAxios } from '@/hooks/web/useAxios'
import type { TableData } from './types'
const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 标签组列表
export const adminCsTagGroupListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsTagGroupList',
      data: data
    }
  })
}

// 标签组修改
export const adminCsTagGroupEditApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsTagGroupEdit',
      data: data
    }
  })
}

// 标签组新增
export const adminCsTagGroupAddApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsTagGroupAdd',
      data: data
    }
  })
}

// 标签组删除
export const adminCsTagGroupDelApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsTagGroupDel',
      data: data
    }
  })
}

// 标签组批量删除
export const adminCsTagGroupBatchDelApi = (data: { ids: string }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsTagGroupBatchDel',
      data: data
    }
  })
}
